package com.sinosoft.bee.services.cousumerwithfeign.demo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sinosoft.bee.services.cousumerwithfeign.demo.entity.User;
import com.sinosoft.bee.services.cousumerwithfeign.demo.mapper.UserMapper;
import com.sinosoft.bee.services.cousumerwithfeign.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getAllUsers() {
        return userMapper.findAll();
    }

    @Override
    public PageInfo<User> getUserByPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<User> all = userMapper.findAll();
        PageInfo<User> info = new PageInfo<>(all);
        return info;
    }
}
